package questionSolution.Question_3;

import java.util.Scanner;

public class Solution_1 {
    static void main() {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        Solution_1 sol = new Solution_1();
        int ans = sol.lengthOfLongestSubstring(s);
        System.out.println(ans);
    }


    public int lengthOfLongestSubstring(String s) {
        int ans = 0;
        int[] last = new int[128];
        for (int i = 0; i < 128; i++) {
            last[i] = -1;
        }
        int start = 0;
        for (int i = 0; i < s.length(); i++) {
            int index = s.charAt(i);
            start = Math.max(start, last[index] + 1);
            ans = Math.max(ans, i - start + 1);
            last[index] = i;
        }
        return ans;
    }
}
